//-----------------------------------------------------------------------
//  Rewrite it from Google ARCore ObjectManipulation
//  Davidwang 2019.09.15
//-----------------------------------------------------------------------

namespace Davidwang
{
    using Davidwang.Internal;
    using UnityEngine;

    /// <summary>
    /// Gesture Recognizer for when the user performs a two finger drag motion on the touch screen.
    /// </summary>
    public class TwoFingerDragGestureRecognizer : GestureRecognizer<TwoFingerDragGesture>
    {
        private const float k_SlopInches = 0.1f;
        private const float k_AngleThresholdRadians = Mathf.PI / 6;

        internal float m_SlopInches
        {
            get
            {
                return k_SlopInches;
            }
        }

        internal float m_AngleThresholdRadians
        {
            get
            {
                return k_AngleThresholdRadians;
            }
        }

        /// <summary>
        /// Creates a two finger drag gesture with the given touches.
        /// </summary>
        /// <param name="touch1">The first touch that started this gesture.</param>
        /// <param name="touch2">The second touch that started this gesture.</param>
        /// <returns>The created Swipe gesture.</returns>
        internal TwoFingerDragGesture CreateGesture(Touch touch1, Touch touch2)
        {
            return new TwoFingerDragGesture(this, touch1, touch2);
        }

        /// <summary>
        /// Tries to create a two finger drag gesture.
        /// </summary>
        protected internal override void TryCreateGestures()
        {
            TryCreateTwoFingerGestureOnTouchBegan(CreateGesture);
        }
    }
}
